MsgBox

This function displays a message box to the user. The construction of the message box depends on:
a. Your text string entry; b) Which message box type was selected (i.e. information only versus ones with buttons); c) Which button values you select and whether the buttons are customized; d) If you added customized text for the caption of the buttons; and e) If you added a caption to your message box in addition to the message. When a user selects a button, you can use the return to control the next behavior of your strip.

If you have a message box script that defines customized buttons, and you only want a string value returned when a user selects one of the customized buttons at runtime, you can force RFgen to only return the string value of the customized button.

To force this change, set the Configuration > Environment Settings > System Options > Use Legacy Message Box to True.

If however, you want an integer value after the user selects a message box button (a customized button or VBA provided button), leave the Use Legacy Message box value equal to False.

Group: Application-Based Extension


Syntax: vValue = App.MsgBox(sMessage, [enType], [iDefault], [vButtons], [vCaption])

The ‘value’, ‘type’, ‘default’, and ‘buttons’ variables match those of the Visual Basic MsgBox function; e.g.:

vValue        (Variant) will contain an integer or string indicating which selection was made.
vbOK =OK button
vbCancel =Cancel button
vbAbort=Abort button
vbRetry =Retry button
vbIgnore = Ignore button
vbYes =Yes button
vbNo =No button

sMessage   (String) the message text to be displayed on the device

enType       (enMsgBoxTypes) Optional – the expected responses:
vbOkOnly = OK
vbOkCancel = OK, Cancel
vbAbortRetryIgnore = Abort, Retry, Ignore
vbYesNoCancel = Yes, No, Cancel
vbYesNo = Yes, No
vbRetryCancel = Retry, Cancel
vbCritical – displays the Critical icon
vbCustom – displays the Custom icon
vbExclamation – displays the Exclamation icon
vbInformation – displays the Information icon
vbQuestion – displays the Question icon

iDefault       (Integer) Optional – an optional message box default:
1 = First Button
2 = Second Button
3 = Third Button

vButtons     (Variant) Optional – captions for the custom buttons;
“[A] [B]” will set “A’ as the caption for the
first button, “B” for the second.

vCaption     (Variant) Optional – the text that appears as the title of the message box

Example:

Dim vValue As Variant

vValue = App.MsgBox("Ok?", vbCritical+vbRetryCancel)

' Combine the Type parameter and sequence number to create the icon and the button type desired.

vValue = App.MsgBox("Continue with transaction?", vbYesNo, 1)

Dim vValue as Variant

vValue = App.MsgBox("Continue with transaction?", vbYesNo, 1, "[Good] [Bad]", "Program Stopped")

If App.MsgBox("OK?", vbYesNo) = vbNo Then Exit Sub

The result in Value will be a string containing the label of the button pressed only if custom buttons are used. Otherwise the button number is returned. Defining unique buttons returns the name of the selected button.

Version Supported:      RFgen 4.0, 4.1, 5.0, 5.1, 5.2 and newer.